package com.qf.day06.homework;

import java.util.Random;

/**
 * Hero ，属性有 名字，力量，智力，敏捷， 方法有 徒手攻击（攻击力=力量的上下百分之20）
 */
public class Hero {
    private String name;//名字
    private int strength;//力量
    private int agility;//敏捷
    private int intellect;//智力
    private int attack;//攻击力

    public int unarmedAttack() {//徒手攻击
        Random random = new Random();
        strength = random.nextInt(120 - 80) + 80;
        return attack = this.strength;

    }

    public Hero() {
    }

    public Hero(String name, int strength, int agility, int intellect) {
        this.name = name;
        this.strength = strength;
        this.agility = agility;
        this.intellect = intellect;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getStrength() {
        return strength;
    }

    public void setStrength(int strength) {
        this.strength = strength;
    }

    public int getAgility() {
        return agility;
    }

    public void setAgility(int agility) {
        this.agility = agility;
    }

    public int getIntellect() {
        return intellect;
    }

    public void setIntellect(int intellect) {
        this.intellect = intellect;
    }

    public int getAttack() {
        return attack;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    @Override
    public String toString() {
        return "Hero{" +
                "name='" + name + '\'' +
                ", strength=" + strength +
                ", agility=" + agility +
                ", intellect=" + intellect +
                ", attack=" + attack +
                '}';
    }
}
